<?php

use think\migration\Migrator;
use think\migration\db\Column;

class User extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('user',['engine'=>'MyISAM']);
        $table
            ->addColumn('name','string',['limit'=>32,'default'=>'','comment'=>'名字'])
            ->addColumn('password','string',['limit'=>64,'default'=>'','comment'=>'密码'])
            ->addColumn('department_id','boolean',['limit'=>3,'default'=>0,'comment'=>'部门id'])
            ->addColumn('job_id','integer',['limit'=>11,'default'=>0,'comment'=>'岗位'])
            ->addColumn('contact_name','string',['limit'=>32,'default'=>'','comment'=>'紧急联系人'])
            ->addColumn('contact_mobile','string',['limit'=>11,'default'=>'','comment'=>'手机号'])
            ->addColumn('relation','string',['limit'=>32,'default'=>'','comment'=>'关系'])
            ->addColumn('email','string',['limit'=>32,'default'=>'','comment'=>'邮箱'])
            ->addColumn('bank_card','string',['limit'=>32,'default'=>'','comment'=>'银行卡号'])
            ->addColumn('qq','string',['limit'=>32,'default'=>'','comment'=>'qq号'])
            ->addColumn('status','boolean',['limit'=>3,'default'=>0,'comment'=>'用户状态'])
            ->addColumn('create_time','datetime',['comment'=>'创建时间'])
            ->create();
    }
}
